package net.chathu.airgw.packets.gw.clientpackets 
{
	import flash.utils.ByteArray;
	import net.chathu.airgw.Config;
	import net.chathu.airgw.model.P2PGroupInfo;
	import net.chathu.airgw.model.Room;
	import net.chathu.airgw.packets.gw.serverpackets.EchoPacket;
	import net.chathu.airgw.packets.gw.serverpackets.ErrorNoSuchChannelPacket;
	import net.chathu.airgw.packets.gw.serverpackets.JoinPacket;
	import net.chathu.airgw.util.ByteArrayUtil;
	/**
	 * ...
	 * @author ze
	 */
	public class CMDGWUpdateCheck extends IRCReceivablePacket 
	{
		
		public function CMDGWUpdateCheck() 
		{
			
		}
		
		override public function execute():void {
			var groupName:String;
			if (data.length >= 1)
			{
				groupName = data[1];
			} else {
				groupName = "&gw";
			}
			
			var p2pGroupInfo:P2PGroupInfo = sessionData.getP2PGroupInfo(groupName);
			if (p2pGroupInfo)
			{
				sessionData.soul.p2pChatConnection.sendUpdateNotify(groupName);
				sendToClient(new EchoPacket(Config.GW_ECHO_NICK, "Sent update notify to group: " + groupName));
			} else {
				sendToClient(new EchoPacket(Config.GW_ECHO_NICK, "No such group: " + groupName));
			}
		}
		
		public static function getShortUsageDescription():String {
			return "Gateway update";
		}
	}

}